﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Teris
{
    internal class InputBlock
    {
        Thread inputThread;

        public event Action inputEvent;

        private static InputBlock instance;
        public static InputBlock Instance
        {
            get 
            {
                if (instance == null)
                { 
                    instance = new InputBlock();
                }
                return instance;
            }
        }

        private InputBlock()
        {
            inputThread = new Thread(InputCheck);
            inputThread.IsBackground = true;
            inputThread.Start();
        }

        void InputCheck()
        {
            while (true)
            {
                inputEvent?.Invoke();
            }
        }
    }
}
